import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { Language } from "../../../../../extend/language/Language";
import { Alert } from "../../../../../com/mui/controls/Alert";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { SGangFightsTeamMember } from "../../../../../Message/Public/SGangFightsTeamMember";
import { GButton } from "../../../../../com/mui/controls/GButton";
type int = number;
//class GangFightsChangeCaptainCellRenderer
    
    export  class GangFightsChangeCaptainCellRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._tfName = ObjCreate.createTextField("", 15, 13, 100, 20, this, GlobalStyle.textFormat6);
            this._btnChangeCaptain = ObjCreate.createGButton(Language.getString(44421), 174, 9, 70, 22, this);
            ObjCreate.createBg(0, 38, 250, 2, this, "SplitLine");
            this._btnChangeCaptain.addEventListener(flash.events.MouseEvent.CLICK, this.onClickChangeCaptain);
            return;
        }

        /* internal  */onClickChangeCaptain(arg1: Object /* flash.events.MouseEvent */): void
        {
            Alert.show(Language.getStringByParam(44422, this._teamMember.name), null, Alert.OK | Alert.CANCEL, null, this.onCloseChangeCaptainAlert);
            return;
        }

        /* internal  */onCloseChangeCaptainAlert(arg1: int): void
        {
            if (arg1 == Alert.OK && this._teamMember) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.GangFightsChangeCaptain, this._teamMember.entityId));
            }
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "sgangfightsteammember") 
            {
                this._teamMember = arg1 as SGangFightsTeamMember;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            if (this._teamMember) 
            {
                this._tfName.text = this._teamMember.name;
            }
            return;
        }

        /* internal */ /* var */_tfName: Object /* flash.text.TextField */;

        /* internal */ /* var */_btnChangeCaptain: GButton;

        /* internal */ /* var */_teamMember: SGangFightsTeamMember;
    }
